package com.xing.yunji.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xing.yunji.model.domain.User;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


/**
* @author 17916
* @description 针对表【user(用户表)】的数据库操作Service
* @createDate 2023-03-08 20:01:56
*/
public interface UserService extends IService<User> {
    /**
     * 用户注册
     * @param userAccount 用户账户
     * @param userPassword 用户密码
     * @param checkPassword 校验密码
     * @return 新用户id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户登录
     * @param userAccount 用户账号
     * @param userPassword 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    User userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 用户脱敏
     * @param user
     * @return
     */
    User getSaftyUser(User user);

    List<User> searchUsersByTags(List<String> tagNameList,HttpServletRequest request);

    int updateUser(User user,User loginUser);

    User getLoginUser(HttpServletRequest request);

    boolean isAdmin(User user);

    boolean isAdmin(HttpServletRequest request);

    /**
     * 根据登录用户的标签，匹配num个相似的用户，根据编辑距离算法
     * @param num
     * @param loginUser
     * @return
     */
    List<User> matchUsers(long num, User loginUser);
}
